<template>
  <button 
    class="tool-btn" 
    :class="{ 'active': isActive }"
    @click="handleClick"
    :title="title">
    <i :class="icon"></i>
    <span><slot></slot></span>
  </button>
</template>

<script>
export default {
  name: 'ToolButton',
  props: {
    icon: {
      type: String,
      required: true
    },
    isActive: {
      type: Boolean,
      default: false
    },
    title: {
      type: String,
      default: ''
    }
  },
  methods: {
    handleClick() {
      this.$emit('click');
    }
  }
}
</script>

<style scoped>
.tool-btn {
  background: transparent;
  border: 1px solid #4a4a4a;
  color: #fff;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all 0.2s;
  margin: 0 2px;
}

.tool-btn:hover {
  background: #3a3a3a;
}

.tool-btn.active {
  background: #409EFF;
  border-color: #409EFF;
}

.tool-btn i {
  font-size: 16px;
}

.tool-btn span {
  font-size: 12px;
}
</style>
